package com.agent.commons.exception;

import com.agent.commons.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;

/**
 * 自定义异常
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Getter
public class BaseException extends RuntimeException{
    /**
     * 自定义异常码
     */
    private Integer code;
    /**
     * 自定义异常描述
     */
    private String msg;
    public BaseException() {

    }

    public BaseException(Integer code, String message) {
        this.code = code;
        this.msg = message;
    }

    public BaseException(ErrorCode error){
        this.code = error.getCode();
        this.msg = error.getMessage();
    }

}
